<template>
  <div>
    <input type="text" v-model="v.name"/>
    <input type="text" v-model="v.comment"/>
    <button @click.prevent="submit">提交</button>
  </div>
</template>

<script>
  export default {
    name: "Add",
    props: ["add"],
    data() {
      return {
        v: {
          name: "",
          comment: ""
        }
      }
    },
    methods: {
      submit() {
        this.add(this.v);
        // 清除输入
        this.v = {}
      }
    }
  }
</script>

<style scoped>

</style>
